package com.retail.bbq.cola.utils;

import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;

import java.util.Date;

public class CommonRedisKeyUtils {
    /**
     * 当前当周题目答题缓存
     *
     * @param questionId
     * @param openId
     * @return
     */
    public static String getCustomerAnswerCacheKey(Integer questionId, String openId) {
        return "BBQ_" + questionId + "_" + openId;
    }

    /**
     * 答题历史的缓存key
     *
     * @param buCode
     * @param setupId
     * @param openId
     * @return
     */
    public static String getCustomerAnswerHistoryCacheKey(String buCode, String setupId, String openId) {
        return "BBQ_" + buCode + "_" + setupId + "_" + openId + "_history";
    }

    /**
     * 题目缓存key
     * @param nowDate
     * @param buCode
     * @param setupId
     * @return
     */
    public static String getQuestionDetailCacheKey(Date nowDate, String buCode, String setupId) {
        return "BBQ_" + DateUtil.format(nowDate, DatePattern.NORM_DATE_FORMATTER) + "_" + buCode + "_" + setupId;
    }
}
